package io.sage.modules.enterwarehouse.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import io.sage.modules.enterwarehouse.dao.BReturnRecordsMapper;
import io.sage.modules.enterwarehouse.entity.BReturnRecords;
import io.sage.modules.enterwarehouse.service.BReturnRecordsService;

@Service("returnRecordsService")
public class BReturnRecordsServiceImpl implements BReturnRecordsService {
	
	@Autowired
	private BReturnRecordsMapper returnRecordsMapper;
	
	@Override
	public List<BReturnRecords> selectReturnRecordsList(Map<String, Object> params) {
		return returnRecordsMapper.selectReturnRecordsList(params);
	}

	@Override
	public int deleteBatchIds(Integer[] ids) {
		return returnRecordsMapper.deleteBatchIds(ids);
	}

	@Override
	public BReturnRecords selectByPrimaryKey(Integer id) {
		return returnRecordsMapper.selectByPrimaryKey(id);
	}

	@Override
	public int insert(BReturnRecords returnRecords) {
		returnRecords.setCreateTime(new Date());
		returnRecords.setIsDel(0);
		returnRecords.setUpdateTime(new Date());
		return returnRecordsMapper.insertSelective(returnRecords);
	}

	@Override
	public int updateByPrimaryKeySelective(BReturnRecords returnRecords) {
		
		returnRecords.setUpdateTime(new Date());
		return returnRecordsMapper.updateByPrimaryKeySelective(returnRecords);
	}

	/**
	 *  批量新增
	 * @param leadBGoodsId goodsIDs
	 * @return
	 */
	@Override
	public int batchInsert(Map<String,Object> param) {
		//从申请记录表中获取最新已领取记录的用户ID
		return returnRecordsMapper.batchInsert(param);
	}
}
